<template>
  <div class="datum">
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">所属项目</span>
        <span class="right" v-if="deviceInformation.projectName != ''">{{
          deviceInformation.projectName
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">负责人</span>
        <span class="right" v-if="deviceInformation.project_name != ''">{{
          deviceInformation.project_name
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">手机号码</span>
        <span class="right" v-if="deviceInformation.project_phone != ''">{{
          deviceInformation.project_phone
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">所属组</span>
        <span class="right" v-if="deviceInformation.groupName != ''">{{
          deviceInformation.groupName
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">负责人</span>
        <span class="right" v-if="deviceInformation.group_name != ''">{{
          deviceInformation.group_name
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">手机号码</span>
        <span class="right" v-if="deviceInformation.group_phone != ''">{{
          deviceInformation.group_phone
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>

    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">所属门店</span>
        <span class="right" v-if="deviceInformation.storeName != ''">{{
          deviceInformation.storeName
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">负责人</span>
        <span class="right" v-if="deviceInformation.store_name != ''">{{
          deviceInformation.store_name
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">手机号码</span>
        <span class="right" v-if="deviceInformation.store_phone != ''">{{
          deviceInformation.store_phone
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">手机号码</span>
        <span class="right" v-if="deviceInformation.store_phone != ''">{{
          deviceInformation.store_phone
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">生产日期</span>
        <span class="right" v-if="deviceInformation.create_time != ''">{{
          deviceInformation.create_time
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">入库日期</span>
        <span class="right" v-if="deviceInformation.store_time != ''">{{
          deviceInformation.store_time
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">出厂日期</span>
        <span class="right" v-if="deviceInformation.out_time != ''">{{
          deviceInformation.out_time
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">安装日期</span>
        <span class="right" v-if="deviceInformation.install_time != ''">{{
          deviceInformation.install_time
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">制造厂商</span>
        <span class="right" v-if="deviceInformation.cooperName != ''">{{
          deviceInformation.cooperName
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">检测芯片ID</span>
        <span class="right" v-if="deviceInformation.detectionChip != ''">{{
          deviceInformation.detectionChip
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">温控器型号</span>
        <span class="right" v-if="deviceInformation.model_name != ''">{{
          deviceInformation.model_name
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
    <div class="datum-rowa">
      <div class="row-a">
        <span class="left">温控器版本号</span>
        <span class="right" v-if="deviceInformation.versionNumber != ''">{{
          deviceInformation.versionNumber
        }}</span>
        <span class="right" v-else>无</span>
      </div>
    </div>
  </div>
</template>
<script>
import { deviceInformation } from "../../utils/api";
export default {
  data() {
    return {
      // 设备id
      id: 0,
      processingStatus: "",
      deviceInformation: {}
    };
  },
  methods: {
    // 获取设备基本详情
    getDeviceData() {
      this.postRequest(deviceInformation, { id: this.id }).then(res => {
        if (res.code == 200) {
          this.deviceInformation = res.data[0];
        }
      });
    }
  },
  created() {
    // 获取设备id
    this.processingStatus = window.sessionStorage.getItem("processingStatus");
    if (window.sessionStorage.getItem("deviceId") != null) {
      this.id = window.sessionStorage.getItem("deviceId");
    } else {
      this.id = JSON.parse(window.sessionStorage.getItem("facilityData")).id;
    }
    this.getDeviceData();
  }
};
</script>
<style lang="less" scoped>
.datum {
  border-top: 1px solid #eaedf3;
  padding: 20px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  flex-wrap: wrap;
  .datum-rowa {
    width: 30%;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(234, 237, 243, 1);
    padding-right: 5px;
    margin: 0px 30px 20px 0px;
    .row-a {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      span {
        display: block;
        height: 100%;
        line-height: 32px;
        font-size: 13px;
      }
      .left {
        text-align: right;
        background-color: #eaedf3;
        width: 35%;
        color: rgba(158, 160, 165, 1);
        padding-right: 10px;
      }
      .right {
        text-align: left;
        background: rgba(255, 255, 255, 1);
        width: 65%;
        padding-left: 10px;
      }
    }
  }
}
</style>
